<template>
  <div class="login-container">
    <img src="@/assets/image-2.png" alt="" />
    <div class="login-wrap br-25">
      <h1>歡迎登錄</h1>
      <el-form :model="loginFormData">
        <div class="user-wrap wrap br-5">
          <svg-icon icon-class="password"></svg-icon>
          <el-input placeholder="請輸入用戶名"></el-input>
        </div>
        <div class="pwd-wrap wrap br-5">
          <svg-icon icon-class="password"></svg-icon>
          <el-input placeholder="請輸入密碼" type="password"></el-input>
        </div>
        <div class="code-wrap br-5">
          <div>
            <svg-icon icon-class="code"></svg-icon>
            <el-input placeholder="請輸入驗證碼"></el-input>
          </div>
          <div class="img-code" alt="點擊刷新">QEUP</div>
        </div>
        <div class="remember-wrap">
          <div>
            <el-checkbox>記住我</el-checkbox>
          </div>
          <div>
            <el-button type="text">忘記密碼</el-button>
          </div>
        </div>
        <el-button type="primary" style="width: 100%" @click.native="handleLogin">登入</el-button>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'login',
  data() {
    return {
      loginFormData: {}
    }
  },
  methods: {
    handleLogin() {
      this.$api.login().then(() => {
        console.log('登录成功')
        this.$router.push('/index')
      })
    }
  }
}
</script>

<style scoped lang="less">
.login-container {
  width: 100%;
  height: 100%;
  background: url('@/assets/image-1.png') no-repeat center center;
  background-size: cover;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  .login-wrap {
    background: #fff;
    padding: 42px 47px;
    width: 483px;
    height: 520px;
    box-sizing: border-box;
    margin-left: 150px;
    h1 {
      font-size: 25px;
      line-height: 35px;
      color: #000;
      margin: 0 0 30px 0;
    }
    .wrap {
      line-height: 25px;
      display: flex;
      justify-content: flex-start;
      flex-wrap: nowrap;
      align-items: center;
      margin-bottom: 20px;
      padding: 11px 22px;
      background: #f5f7fa;
      .svg-icon {
        font-size: 25px;
      }
      ::v-deep .el-input__inner {
        border: none;
        background: #f5f7fa;
        height: unset;
        line-height: unset;
      }
    }
    .code-wrap {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;
      > div:first-child {
        margin-right: 16px;
        line-height: 25px;
        display: flex;
        justify-content: flex-start;
        flex-wrap: nowrap;
        align-items: center;
        padding: 11px 22px;
        background: #f5f7fa;
        ::v-deep .el-input__inner {
          border: none;
          background: #f5f7fa;
          height: unset;
          line-height: unset;
        }
      }
      .img-code {
        cursor: pointer;
        flex: auto;
        border: 1px solid rgba(0, 0, 0, 0.09);
        text-align: center;
        align-content: center;
      }
    }
    .remember-wrap {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 30px;
    }
  }
}
</style>
